package com.hdoit.ares.web.share.modelconfig;
import com.hdoit.ares.web.share.providers.ShareCourseKindsStateProvider;
import com.hdoit.ares.web.share.providers.ShareCourseTypeStateProvider;
import com.hdoit.ares.web.share.providers.TrainCurrencyStateProvider;
import com.hdoit.ares.web.share.providers.ViewTimeStateProvider;
import com.tennetcn.common.enums.regular.MathRegularExpressions;
import com.tennetcn.component.attribute.DisplayNameAttribute;
import com.tennetcn.component.attribute.DropDownListAttribute;
import com.tennetcn.component.attribute.RegularExpressionAttribute;
import com.tennetcn.component.attribute.RequiredAttribute;
import com.tennetcn.component.attribute.base.ModelMetadataAttributeConfiguration;

/**
 * @author      wangxuexue
 * @email       
 * @createtime  2017年11月23日 14:50:16
 * @comment
 */
public class TrainCourseConfig extends ModelMetadataAttributeConfiguration{
    public TrainCourseConfig(){
        this.setProperty("courseTitle")
            .hasAttribute(new DisplayNameAttribute("标题"))
        .hasAttribute(new RequiredAttribute("教程类型为必填项"));

        this.setProperty("courseTeacher")
            .hasAttribute(new DisplayNameAttribute("导师"));

        this.setProperty("courseDescription")
            .hasAttribute(new DisplayNameAttribute("简介"));

        this.setProperty("courcePathId")
            .hasAttribute(new DisplayNameAttribute("视频"));

        this.setProperty("courceThumbnailId")
            .hasAttribute(new DisplayNameAttribute("缩略图"))
        .hasAttribute(new RequiredAttribute("缩略图为必填项"));

        this.setProperty("courceTrueprice")
            .hasAttribute(new DisplayNameAttribute("销售价格"));
            /*.hasAttribute(new RegularExpressionAttribute("^((\\d{1,9}.\\d{1,2})|(\\d{1,9}))$"));*/

        this.setProperty("courceSellingprice")
            .hasAttribute(new DisplayNameAttribute("活动价格"));
       /*.hasAttribute(new RegularExpressionAttribute("^((\\d{1,9}.\\d{1,2})|(\\d{1,9}))$"));*/
        
        this.setProperty("courceTrueCurrency")
            .hasAttribute(new DisplayNameAttribute("销售价格币种"))
        .hasAttribute(new DropDownListAttribute(new TrainCurrencyStateProvider()));

        this.setProperty("courceSellingCurrency")
            .hasAttribute(new DisplayNameAttribute("活动价格币种"))
        .hasAttribute(new DropDownListAttribute(new TrainCurrencyStateProvider()));

        this.setProperty("sortCode")
            .hasAttribute(new DisplayNameAttribute("排序代码"))
            .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));

        this.setProperty("createBy")
            .hasAttribute(new DisplayNameAttribute("创建人"));

        this.setProperty("modifyBy")
            .hasAttribute(new DisplayNameAttribute("修改人"));

        this.setProperty("code")
            .hasAttribute(new DisplayNameAttribute("全拼"));

        this.setProperty("markCode")
            .hasAttribute(new DisplayNameAttribute("连拼"));

        this.setProperty("courseType")
            .hasAttribute(new DisplayNameAttribute("类型"))
        .hasAttribute(new DropDownListAttribute(new ShareCourseTypeStateProvider()))
        .hasAttribute(new RequiredAttribute("类型为必填项"));
        
        this.setProperty("courseKinds")
            .hasAttribute(new DisplayNameAttribute("种类"))
        .hasAttribute(new DropDownListAttribute(new ShareCourseKindsStateProvider()))
        .hasAttribute(new RequiredAttribute("种类为必填项"));
        
        this.setProperty("viewTimes.type")
        .hasAttribute(new DisplayNameAttribute("资源类型"))
        .hasAttribute(new DropDownListAttribute(new ViewTimeStateProvider()));

    this.setProperty("viewTimes.viewtimes")
        .hasAttribute(new DisplayNameAttribute("浏览次数"))
        .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));
    }
}